package com.lanyou.esb.servicemix.bean;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.FastDateFormat;

import com.lanyou.cook.common.Constants;

/**
 * Created by gonglei on 16/5/16.
 */
public class Log {

    private int id;

    private String received;

    private String level;

    private int raw_level;

    private String message;

    private String service;

    private String exception;

    private int bundleId;

    private String bundleName;
    
	private static FastDateFormat fastDateFormat = FastDateFormat
			.getInstance(Constants.DATETIME_PATTERN_1);
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getReceived() {
        return received;
    }
    
	public String getReceivedStr() {
		if (StringUtils.isBlank(received)) {
			return "";
		}
		try {
			return fastDateFormat.format(Long.parseLong(received));
		} catch (Exception e) {
			return "";
		}
	}

    public void setReceived(String received) {
        this.received = received;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public int getRaw_level() {
        return raw_level;
    }

    public void setRaw_level(int raw_level) {
        this.raw_level = raw_level;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public String getException() {
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }

    public int getBundleId() {
        return bundleId;
    }

    public void setBundleId(int bundleId) {
        this.bundleId = bundleId;
    }

    public String getBundleName() {
        return bundleName;
    }

    public void setBundleName(String bundleName) {
        this.bundleName = bundleName;
    }

	@Override
	public String toString() {
		return "Log [id=" + id + ", received=" + received + ", level=" + level + ", raw_level=" + raw_level
				+ ", message=" + message + ", service=" + service + ", exception=" + exception + ", bundleId="
				+ bundleId + ", bundleName=" + bundleName + "]";
	}
    
    
}
